﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
		<% if (ViewData["OrderResult"] != null && ViewData["OrderResult"].ToString() != ""){ %>
			alert('<%= ViewData["OrderResult"].ToString() %>');
		<% } %>
    </script>
    <div class="content_panel">
        <div class="cate_area">
            <div class="bg_nav">
                <a href="<%= Url.Action("Index", "Home") %>">Trang chủ</a> » Lịch sử giao dịch
            </div>
            <div class="bg_760">
                <h4>
                    Lịch sử giao dịch</h4>
            </div>
            <div class="clear">
            </div>
            <div class="bg_760_center" style="padding: 10px; width: 738px">
                <div id="div_cart">
                    <br />
                    <table rules="all" style="width: 100%; border: 1px solid rgb(187, 216, 241);" cellpadding="10"
                        cellspacing="10">
                        <tbody style="font-size: 12px;">
                            <tr style="color: rgb(2, 79, 147); background-color: rgb(239, 249, 255); font-weight: bold;"
                                align="center">
                                <th>
                                    ID
                                </th>
                                <th>
                                    Ngày đặt hàng
                                </th>
                                <th>
                                    Đã xác nhận
                                </th>
                                <th>
                                    Đã giao hàng
                                </th>
                                <th>
                                </th>
                            </tr>
                            <% for (int i = 0; i < Model.DonDatHangModel.GetModel.LstObjModel.Count; i++)
                               { %>
                            <tr style="height: 20px">
                                <td style="text-align: center;">
                                    <span style="">
                                        <%= Model.DonDatHangModel.GetModel.LstObjModel[i].ID %></span>
                                </td>
                                <td style="text-align: center">
                                    <span style="">
                                        <%= string.Format("{0:dd/MM/yyyy hh:mm:ss}", Model.DonDatHangModel.GetModel.LstObjModel[i].NgayDatHang.Value)%></span>
                                </td>
                                <td style="text-align: center; vertical-align: middle">
                                    <span style="">
                                        <%= Html.CheckBox("IsVerified", Model.DonDatHangModel.GetModel.LstObjModel[i].DaXacNhan.Value, new { disabled = "disabled" })%></span>
                                </td>
                                <td style="text-align: center; vertical-align: middle">
                                    <span style="">
                                        <%= Html.CheckBox("IsShipped", Model.DonDatHangModel.GetModel.LstObjModel[i].DaGiaoHang.Value, new { disabled = "disabled" })%></span>
                                </td>
                                <td style="text-align: center">
                                    <a href="../../Home/SelectOrderDetailByIDOrder?iduser=<%= Model.UsersModel.GetModel.LstObjModel[0].BaseInfo.ID %>&idorder=<%= Model.DonDatHangModel.GetModel.LstObjModel[i].ID %>">
                                        <span style="">Chi tiết</span> </a>
                                </td>
                            </tr>
                            <% } %>
                        </tbody>
                    </table>
                    <% if (Model.SelectedDonDatHangModel != null)
                       { %>
                    <%
                        var total = 0.0;
                        for (int i = 0; i < Model.ChiTietDonDatHangModel.GetModel.LstObjModel.Count; i++)
                        {
                            total += (Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].SoLuong.Value * Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].Gia.Value);
                        }
                    %>
                    <div style="text-align: left;">
                        <br />
                        <br />
                        <span style="font-size: 18px; font-weight: bold;">Mã đơn đặt hàng
                            <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].ID %></span>
                        <br />
                        <br />
                        <table class="AdminPageText">
                            <tr>
                                <td width="130" style="font-weight: bold;">
                                    Tổng tiền:
                                </td>
                                <td style="font-weight: bold; color: Red">
                                    <%= string.Format("{0:0,0}", total)%> ₫
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Mã Khách hàng:
                                </td>
                                <td>
                                    <%= Model.UsersModel.GetModel.LstObjModel[0].BaseInfo.ID %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Tên khách hàng:
                                </td>
                                <td>
                                    <%= Model.UsersModel.GetModel.LstObjModel[0].ExtraInfo.HoTen %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Tên người nhận:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].TenNguoiNhan %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    SĐT người nhận:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].SoDienThoaiNguoiNhan %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Địa chỉ người nhận:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].DiaChiNguoiNhan %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Ngày đặt hàng:
                                </td>
                                <td>
                                    <%= string.Format("{0:dd/MM/yyyy hh:mm:ss}", Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].NgayDatHang.Value)%>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Đã xác nhận:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].DaXacNhan.Value ? "Rồi" : "Chưa" %>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Đã giao hàng:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].DaGiaoHang.Value ? "Rồi" : "Chưa"%>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Ngày giao hàng:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].NgayGiaoHang != null ? string.Format("{0:dd/MM/yyyy hh:mm:ss}", Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].NgayGiaoHang.Value) : string.Empty%>
                                </td>
                            </tr>
                            <tr>
                                <td width="130">
                                    Chú thích thêm:
                                </td>
                                <td>
                                    <%= Model.SelectedDonDatHangModel.GetModel.LstObjModel[0].ChuThich %>
                                </td>
                            </tr>
                        </table>
                        <br />
                        <div style="height: 20px;">
                            <span style="font-weight: bold;">Chi tiết đơn đặt hàng</span>
                        </div>
                        <table rules="all" style="width: 100%; border: 1px solid rgb(187, 216, 241);" cellpadding="10"
                            cellspacing="10">
                            <tbody style="font-size: 12px;">
                                <tr style="color: rgb(2, 79, 147); background-color: rgb(239, 249, 255); font-weight: bold;"
                                    align="center">
                                    <th style="text-align: center;">
                                        STT
                                    </th>
                                    <th style="text-align: left; padding-left: 10px;">
                                        Tên sản phẩm
                                    </th>
                                    <th style="text-align: center; padding-left: 10px;">
                                        Loại sản phẩm
                                    </th>
                                    <th style="text-align: center;">
                                        Số lượng
                                    </th>
                                    <td style="text-align: center;">
                                        Đơn giá
                                    </th>
                                    <td style="text-align: center;">
                                        Thành tiền
                                    </th>
                                </tr>
                                <% for (int i = 0; i < Model.ChiTietDonDatHangModel.GetModel.LstObjModel.Count; i++)
                                   {
                                       if (i % 2 != 0)
                                       {%>
                                <tr class="Row" id="Tr1" style="height: 20px">
                                    <% }
                                       else
                                       { %>
                                    <tr class="AlternatingRow" id="row-<%= Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].ID %>"
                                        style="height: 20px">
                                        <% } %>
                                        <td style="text-align: center">
                                            <span style="">
                                                <%= (i + 1) %></span>
                                        </td>
                                        <td style="text-align: left; padding-left: 10px;">
                                            <span style="">
                                                <%= Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].SanPham.TenSanPham%></span>
                                        </td>
                                        <td style="text-align: center; padding-left: 10px;">
                                            <span style="">
                                                <%= Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].SanPham.LoaiSanPham%></span>
                                        </td>
                                        <td style="text-align: center">
                                            <span style="">
                                                <%= Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].SoLuong.Value %></span>
                                        </td>
                                        <td style="text-align: center">
                                            <span style="font-weight: bold; color: Red;">
                                                <%= string.Format("{0:0,0}", Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].Gia.Value) %>
                                                ₫</span>
                                        </td>
                                        <td style="text-align: center">
                                            <span style="font-weight: bold; color: Red;">
                                                <%= string.Format("{0:0,0}", Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].SoLuong.Value * Model.ChiTietDonDatHangModel.GetModel.LstObjModel[i].Gia.Value)%>
                                                ₫</span>
                                        </td>
                                    </tr>
                                    <% } %>
                            </tbody>
                        </table>
                    </div>
                    <% } %>
                </div>
            </div>
            <div class="clear">
            </div>
            <div class="bg_760_bt">
            </div>
        </div>
    </div>
</asp:Content>
